// base.service.ts
import SearchDto from "../dtos/search.dto";
import BaseEntity from "./base.entity";
import BaseRepository from "./base.repository";
import IBaseServer from "./interface.base.service";

export default class BaseServer<V> implements IBaseServer<V>{
    protected repository: BaseRepository<V>;
    getBasePageList<D extends SearchDto>(dto: D): Promise<V[]> {
        return this.repository.getList<D>(dto);
    }
    addBaseServer<D, E>(dto: D): void {
        console.log('BaseServer-addBaseServer',dto);        
        const entity = BaseEntity.ToEntity<D, E>(dto)
        this.repository.add<E>(entity)
    }
}